import { IsNotEmpty, IsString, IsInt, IsDate, IsArray, ValidateNested } from 'class-validator';
import { Tournament } from 'src/modules/tournament/entities/tournament.entity';
import { Event } from 'src/modules/event/entities/event.entity';
import { CategoryStatusEnum } from 'src/common/constant/enums';
import { CreateEventDto } from 'src/modules/event/dto/create-event.dto';
import { Type } from 'class-transformer';

export class CreateCategoryDto {
  @IsNotEmpty()
  id: number;

  @IsNotEmpty()
  @IsString()
  name: string;

  @IsNotEmpty()
  @IsString()
  alias: string;

  @IsNotEmpty()
  @IsInt()
  minAge: number;

  @IsNotEmpty()
  @IsInt()
  maxAge: number;

  @IsNotEmpty()
  @IsInt()
  createBy: number;

  @IsNotEmpty()
  @IsDate()
  createTime: Date;

  @IsNotEmpty()
  @IsInt()
  updateBy: number;

  @IsNotEmpty()
  @IsDate()
  updateTime: Date;

  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => CreateEventDto)
  events: CreateEventDto[];

  tournament: Tournament;

  status: CategoryStatusEnum;
}
